package com.dmwork.service.work.controller.front;

import com.dmwork.common.base.result.R;
import com.dmwork.service.work.entity.vo.WorkTypeBriefInfoVo;
import com.dmwork.service.work.entity.vo.WorkTypeDetailInfoVo;
import com.dmwork.service.work.service.WorkTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@Api(description = "前台作品类型业务")
@Transactional
@RestController
@RequestMapping("/front/dm_work/work/work_type")
public class FrontWorkTypeController {

    @Autowired
    private WorkTypeService workTypeService;

    @GetMapping("get_brief_list")
    public R getBriefList() {
        List<WorkTypeBriefInfoVo> workTypeBriefInfoVoList = workTypeService.getBriefInfoList();
        return R.ok().data("item", workTypeBriefInfoVoList);
    }

    @ApiOperation("获取作品类型详情列表")
    @GetMapping("get_detail_list")
    public R getDetailList() {
        List<WorkTypeDetailInfoVo> workTypeDetailInfoVoList = workTypeService.getDetailInfoList();
        return R.ok().data("items", workTypeDetailInfoVoList);
    }

    @ApiOperation(value = "获取作品类型详情")
    @GetMapping("get_detail/{typeId}")
    public R getDetail(@PathVariable("typeId") String typeId) {
        WorkTypeDetailInfoVo workTypeDetailInfoVo = workTypeService.getDetailInfo("front", typeId);
        return R.ok().data("item", workTypeDetailInfoVo);
    }



}
